package com.nightsoul.retrofit.test;

import java.io.File;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.webapp.WebAppContext;


public class Launcher {

	public static void main(String[] args) throws Exception {
		String userDir = System.getProperty("user.dir");
		File webapp = new File(userDir, "src/main/webapp");
		System.out.println(webapp);
		String contextPath = userDir.substring(userDir.lastIndexOf(File.separator) + 1);
		System.out.println(contextPath);
		
		Server server = new Server(8080);
		
		WebAppContext webAppContext = new WebAppContext(webapp.getAbsolutePath(), "/" + contextPath);

		HandlerCollection handlers = new HandlerCollection();
		handlers.addHandler(webAppContext);
		server.setHandler(handlers);

		server.start();
		server.join();

	}

}
